package com.yansu.own.client;

import com.yansu.own.schedule.dingding.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient(name = "dingDingClient", url = "https://oapi.dingtalk.com")
public interface DingDingClient {
    /**
     * 获取登录凭证
     */
    @GetMapping("/gettoken")
    DingDingResponse gettoken(@RequestParam("appkey") String appkey,
                           @RequestParam("appsecret") String appsecret);

    /**
     * 获取订阅号列表
     */
    @PostMapping("/topapi/serviceaccount/list")
    DingDingResponse2<DingDIngSubscription> subscriptionList(@RequestParam("access_token") String access_token,
                              @RequestBody DIngDingPage page);

    /**
     * 获取指定订阅号文章列表
     */
    @PostMapping("/topapi/material/article/list")
    DingDingResponse2<DingDingArticle> articleList(@RequestParam("access_token") String access_token,
                                                   @RequestBody DIngDingPage2 page);

    /**
     * 获取文章详情
     */
    @PostMapping("/topapi/material/article/get")
    DingDingArticleResponse articleDetails(@RequestParam("access_token") String access_token,
                                           @RequestBody DingDingArticleDto dto);
}
